package com.ego.product.feign;

import com.ego.common.to.member.MemberTo;
import com.ego.common.util.Result;
import com.ego.product.vo.member.UserLoginVo;
import com.ego.product.vo.member.UserRegisterVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * @program: ego
 * @description: 会员远程服务
 * @author: KamTang
 * @create: 2022-12-13 17:39
 **/
@FeignClient(value = "ego-member")
public interface MemberFeign {

    /**
     * 用户注册
     * @param register @see
     * @return @see
     * @see UserRegisterVo
     * @see Result
     */
    @PostMapping("/register")
    Result register(@Valid @RequestBody UserRegisterVo register);

    /**
     * 用户登录
     * @param login @see
     * @return @see
     * @see UserLoginVo
     * @see Result
     */
    @PostMapping("/login")
    Result login(@Valid @RequestBody UserLoginVo login);

    /**
     * 根据会员ID获取地址信息
     * @param memberId 会员Id
     * @return @see
     * @see Result
     */
    @GetMapping("member/receive-address/gets/{memberId}")
    Result gets(@PathVariable("memberId") Long memberId);

    /**
     * 修改会员信息
     * @param to to see MemberTo
     * @return 公共返回结果
     * @see MemberTo
     */
    @PostMapping("member/update")
    Result update(@RequestBody MemberTo to);
}
